#ifndef COREDEFINE_H
#define COREDEFINE_H

#include <QHash>
#include "logwriter.h"

#ifndef DEBUG_FUNCTION
    #define DEBUG_FUNC writeLog(QString("[function] %1").arg(__FUNCTION__))
#endif

const static int PORT = 8889;
const static char CHAR_CMD_BEGIN = '@';
const static QString LOGDIR("C:\\Users\\WHDon\\Desktop\\logs\\");

enum TCP_CMD
{
    TCP_CMD_SINGIN,  // 注册
    TCP_CMD_LOGIN  // 登录
};

const static QHash<QString, TCP_CMD> CSMAP_TCP_CMD_NAME =
{
    {QString("C1"), TCP_CMD_SINGIN},
    {QString("C2"), TCP_CMD_LOGIN},
};

static bool isExistTcpCmdName(const QString& name)
{
    for (auto it = CSMAP_TCP_CMD_NAME.begin(); it != CSMAP_TCP_CMD_NAME.end(); ++it)
    {
        if (it.key() == name)
            return true;
    }

    return false;
}

#endif // COREDEFINE_H
